package com.wd.jetpack.ui.viewmodel

import androidx.lifecycle.ViewModel
import com.wd.jetpack.api.ArticleService
import com.wd.jetpack.api.network.BaseNetProvider
import com.wd.jetpack.api.network.NetMgr
import com.wd.jetpack.helper.exytens.async
import com.wd.jetpack.model.ArticleData
import com.wd.jetpack.model.BaseResponse
import io.reactivex.Single

/**
 * NA<BR>
 *
 * @author w4425
 * @version [V5.9.3, 2021/6/17]
 * @since V5.9.3
 */
class RemoteViewModel : ViewModel() {
    private val serviceUrl = "http://v.juhe.cn"
    private val type = "top"
    private val key = "11c615153228e4410561972008d73cd2"

    private var remote = NetMgr.getRetrofit(serviceUrl, BaseNetProvider()).create(ArticleService::class.java)
    fun getArticle(): Single<BaseResponse<ArticleData>> = remote.toutiao(type, key).async()
}